           package com.java.diagnostics.visualizer.parser.xml;
           
           import com.java.diagnostics.visualizer.data.SourceData;
           import com.java.diagnostics.visualizer.exceptions.GCAndMemoryVisualizerException;
           import com.java.diagnostics.visualizer.exceptions.GCAndMemoryVisualizerParsedDataCorruptedException;
           import com.java.diagnostics.visualizer.factory.SourceDataFactory;
           import com.java.diagnostics.visualizer.gc.defaultextensions.util.Messages;
           import com.java.diagnostics.visualizer.parser.vgc.j9.FriendlyXMLParser;
           import com.java.diagnostics.visualizer.properties.OutputProperties;
           import com.java.diagnostics.visualizer.sources.Source;
           import java.io.IOException;
           import java.text.MessageFormat;
           import javax.xml.parsers.ParserConfigurationException;
           import org.xml.sax.SAXException;
           import org.xml.sax.SAXParseException;
           import org.xml.sax.helpers.DefaultHandler;
           
           public abstract class GCAndMemoryVisualizerXMLParser extends DefaultHandler
           {
             protected static final String CONCATENATED_XML_MESSAGE = Messages.getString("GCAndMemoryVisualizerXMLParser.two.files.concatenated");
           
             protected static final String BADLY_FORMED_XML_MESSAGE = Messages.getString("GCAndMemoryVisualizerXMLParser.badly.formed.xml");
             protected static final String XML_REGEX_IN_ERROR_MESSAGE = "[xX][mM][lL]";
             protected static final double MS_PER_SECOND = 1000.0D;
             protected SourceData sourceData = null;
           
             protected static final SourceDataFactory GCANDMEMORYVISUALIZER_SOURCE_DATA_FACTORY = SourceDataFactory.getFactory();
           
             public SourceData parse(Source source, OutputProperties properties)
               throws GCAndMemoryVisualizerException
             {
               String variantIdentifier = source.getVariantIdentifier();
               this.sourceData = 
                 GCANDMEMORYVISUALIZER_SOURCE_DATA_FACTORY.createSourceData(variantIdentifier);
               try
               {
                 FriendlyXMLParser parser = new FriendlyXMLParser();
                 parser.parse(source, this);
                 return this.sourceData;
               }
               catch (SAXParseException e)
               {
                 if (e.getMessage().indexOf("[xX][mM][lL]") > -1) {
                   throw new GCAndMemoryVisualizerParsedDataCorruptedException(
                     CONCATENATED_XML_MESSAGE, e.getLineNumber(), 
                     e.getColumnNumber(), source.getName());
                 }
                 throw new GCAndMemoryVisualizerParsedDataCorruptedException(
                   MessageFormat.format(BADLY_FORMED_XML_MESSAGE, 
                   new Object[] { e.getMessage() }), e
                   .getLineNumber(), e.getColumnNumber(), 
                   source.getName());
               }
               catch (SAXException se) {
                 throw new GCAndMemoryVisualizerException(se);
               }
               catch (ParserConfigurationException pe) {
                 throw new GCAndMemoryVisualizerException(pe);
               }
               catch (IOException ioe) {
/* 101 */       throw new GCAndMemoryVisualizerException(ioe);
               }
               catch (Exception e) {
/* 104 */       throw new GCAndMemoryVisualizerException(e);
               }
             }
           }

